package cn.tedu.tnt_sky.controller.admin;

import cn.tedu.tnt_sky.common.result.Result;
import cn.tedu.tnt_sky.pojo.vo.CommentVO;
import cn.tedu.tnt_sky.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/{id}")
@Api(tags = "管理员查看评论")
public class CommentController {

    @Autowired
    CommentService commentsService;

    @ApiOperation(value = "管理员查看评论")
    @GetMapping("selectById")
    public Result selectById(Long id) {
        List<CommentVO> selectById = commentsService.listById(id);
        return Result.success(selectById);
    }

    @ApiOperation(value = "管理员删除评论")
    @PostMapping("{id}/delete")
    public Result delete(@PathVariable Long id){
        commentsService.delete(id);
        return Result.success();
    }
}